package cpgears.movie.controls {
	import cpgears.movie.IMovie;
	import cpgears.movie.variables.CaptivateVariable;
	/**
	 * Class implementing the movie controls.
	 * 
	 * @author Whyves
	 */
	public class MovieControls implements IMovieControls {
		
		private var mMovie:IMovie = null;
		
		/**
		 * Creates the movie controls.
		 */
		public function MovieControls(movie:IMovie) {
			if (movie == null) throw new ArgumentError("'movie' parameter cannot be null.");
			mMovie = movie;
		}

		/**
		 * @inheritDoc
		 */
		public function play():void {
			mMovie.setCpVariable(CaptivateVariable.RESUME, 1);
		}
		
		/**
		 * @inheritDoc
		 */
		public function pause():void {
			mMovie.setCpVariable(CaptivateVariable.PAUSE, 1);
		}
		
		/**
		 * @inheritDoc
		 */
		public function gotoPreviousSlide():void {
			mMovie.setCpVariable(CaptivateVariable.PREVIOUS, 1);
		}
		
		/**
		 * @inheritDoc
		 */
		public function gotoNextSlide():void {
			mMovie.setCpVariable(CaptivateVariable.NEXT, 1);
		}
		
		/**
		 * @inheritDoc
		 */
		public function exit():void {
			mMovie.setCpVariable(CaptivateVariable.EXIT, 1);
		}
	}
}